<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      window.onload = function () {
        var obj = {
          id: 1,
          pname: "小米",
          price: 1999,
          num: 2000,
        };
        Object.defineProperty(obj, "mj", {
          enumerable: false,
          value: "333",
        });
        console.log(obj);

        for (var key in obj) {
          console.log(key + ": " + obj[key]);
        }

        var arr = Object.keys(obj);

        arr.forEach(function (value) {
          console.log(value);
        });
      };
    </script>
  </head>
  <body></body>
</html>
